<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

    <table  cellSpacing="0" cellPadding="0" align="left"  class="ptable">
		<caption>
			产品详细信息
		</caption>
		<tr class="tr">
			<th class="th" width="25%" scope="col">
				代码
			</th>
			<td class="td" width="75%" scope="col">
				<input name="bean.code" type="text" />
			</td>
		</tr>
		<tr class="tr">
			<th class="th">
				名称
			</th>
			<td class="td">
				<input name="bean.name" type="text" />
			</td>
		</tr>
		<tr class="tr">
			<th class="th">
				价格
			</th>
			<td class="td">
				<input name="bean.price" type="text"   onblur="judgeNumber(this)" />
			</td>
		</tr>
		<tr class="tr">
			<th class="th">
				类型
			</th>
			<td class="td">
			<%
				org.jackysoft.entity.ProductType[] ptypes  =  org.jackysoft.entity.ProductType.values();
					    pageContext.setAttribute("ptypes", ptypes);
					     
					    String[] punit = {"发","万发","公斤","米"};
					    pageContext.setAttribute("punit", punit);
			%>	
			<select name="bean.itemType" id="ptype">
			   <c:forEach items="${ptypes}" var="pt">
            	 <option value="${pt}">${pt}</option>
          	   </c:forEach>
		    </select>
			</td>
		</tr>
		<tr class="tr">
			<th class="th">
				单位
			</th>
			<td class="td">
				<select name="bean.priceUnit" id="punit">
				
				<c:forEach items="${punit}" var="pit">
				   <option value="${pit}">
						${pit}
					</option>
				</c:forEach>
					
				
				</select>
			</td>
		</tr>	
		<tr>
		 <td>所属部门</td>
		 <td><div id="deptlist"></div></td>
		</tr>
	</table>
<script type="text/javascript">
   var action="add"; 
   $(function(){
	   var depts = $("#deptlist");
	   $.getJSON("admin/department/department!bytype", {
			"bean.id" : "root",
			"bean.departmentType" : "Manufacture"
		}, function(data, textStatus, jqXHR) {
			$.each(data, function(i, item) {
				var lb = $("<li><label><input name='bean.providers["
						+ i
						+ "].id' type='checkbox' value='"
						+ item.id
						+ "' id='check_"
						+ i
						+ "' "
						+ " />" + item.name
						+ "</label></li>");
				depts.append(lb);

			});
		});   
   });
</script>	